Python `.pth` files and using relative paths

Posted by kRON on Stack Overflow See other posts from Stack Overflow or by kRON
Published on 2010-04-24T07:34:55Z Indexed on 2010/04/24 7:43 UTC
Read the original article Hit count: 282

Filed under:
|
|
|

I have a lot of development versions of packages installed with virtualenv under the default /src directory in the environment. Normally, I decided to do the development of my project under the /src directory afterwards.

To add my directory to the Python path, I decided to eschew from using any absolute paths, since I'm going to have to move the project around with my friends. It's a Django application, so I was happy with putting environment.pth under the root that contained the path to my project and a wsgi in the same directory would call the sites module to parse environment.pth. All good.

I was also looking to move the .pth file into site-packages, but I'm having trouble with relative paths that move up the directory tree.

For:

/env
 /lib
   /site-pacakges
 /src
   /myproject

So, the .pth entry in site-packages to myproject should look like ../../src/myproject, but this doesn't seem to be working for me on Windows.

© Stack Overflow or respective owner

Related posts about python

Related posts about path